package com.ms.oschina.tagpager;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;

import com.libs.zxing.CaptureActivity;
import com.ms.oschina.R;
import com.ms.oschina.base.BaseFragment;
import com.ms.oschina.ui.activity.ActivitiesActivity;
import com.ms.oschina.ui.activity.FriendsActivity;
import com.ms.oschina.ui.activity.ShakeItActivity;
import com.ms.oschina.ui.activity.SkillsCakeActivity;
import com.ms.oschina.ui.activity.SkillsRadarActivity;
import com.ms.oschina.util.UiUtils;

/**
 * 发现
 * 
 * @author Administrator
 * 
 */
public class ExploreFragment extends BaseFragment implements OnClickListener {
	private LinearLayout rlActive;
	private LinearLayout rlSkillOsc;
	private LinearLayout rlCity;
	private LinearLayout rlActivities;
	private LinearLayout rlScan;
	private LinearLayout rlShake;

	private void findViews(View view) {
		rlActive = (LinearLayout) view.findViewById(R.id.rl_explore_active);
		rlSkillOsc = (LinearLayout) view.findViewById(R.id.rl_explore_skill_osc);
		rlCity = (LinearLayout) view.findViewById(R.id.rl_explore_city);
		rlActivities = (LinearLayout) view.findViewById(R.id.rl_explore_activities);
		rlScan = (LinearLayout) view.findViewById(R.id.rl_explore_scan);
		rlShake = (LinearLayout) view.findViewById(R.id.rl_explore_shake);
	}

	@Override
	public int getLayoutId() {
		return R.layout.fragment_explore;
	}

	@Override
	public void initView(View view) {
		findViews(view);
	}

	public void initData() {
		rlActive.setOnClickListener(this);
		rlCity.setOnClickListener(this);
		rlActivities.setOnClickListener(this);
		rlSkillOsc.setOnClickListener(this);
		rlScan.setOnClickListener(this);
		rlShake.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		Context context = UiUtils.getContext();
		int id = v.getId();

		switch (id) {
		case R.id.rl_explore_active: {
			Intent intent = new Intent(context, FriendsActivity.class);
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(intent);
			break;
		}
		case R.id.rl_explore_skill_osc: {//技能雷达
			Intent intent = new Intent(context, SkillsRadarActivity.class);
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(intent);
			break;
		}
		case R.id.rl_explore_city:
			break;
		case R.id.rl_explore_activities: {
			Intent intent = new Intent(context, ActivitiesActivity.class);
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(intent);
			break;
		}
		case R.id.rl_explore_scan: {
			Intent intent = new Intent(context, CaptureActivity.class);
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(intent);
			break;
		}
		case R.id.rl_explore_shake:
			Intent intent = new Intent(context, ShakeItActivity.class);
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(intent);
			break;
		}
	}
}
